package org.createModel.factory.factory_method;

/**
 * 工厂方法模式
 */
public class ClientTest {
    public static void main(String[] args) {
        CoffeeFactory factory = new AmericanCoffeeFactory();
        CoffeeStore coffeeStore = new CoffeeStore();
        coffeeStore.setFactory(factory);
        Coffee coffee = coffeeStore.orderCoffee();
        System.out.println(coffee.getName());

        factory = new LatteCoffeeFactory();
        coffeeStore.setFactory(factory);
        coffee = coffeeStore.orderCoffee();
        System.out.println(coffee.getName());
    }
}
